<!DOCTYPE html>
<html>
  <head>
    <title>测试IOS与JS之前的互调</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style type="text/css">
      * {
        font-size: 40px;
      }
    </style>
    <script type="text/javascript">
      
      var jsFunc = function() {
        alert('Objective-C 调用 js to show alert');
        // 如果不会调用，因此OCModel并不存在
        OCModel.showAlertMsg('js 的', 'js 信息');
      }
    
    var jsParamFunc = function(argument) {
      document.getElementById('jsParamFuncSpan').innerHTML
      = argument['name'];
    }
    
      </script>
    
  </head>
  
  <body>
    
    <div style="margin-top: 100px">
      <h1>Another page</h1>
      <input type="button" value="Call ObjC system camera" onclick="OCModel.callSystemCamera()">
        <input type="button" value="Call ObjC system alert" onclick="OCModel.showAlertMsg('js title', 'js message')">
    </div>
    
    <div>
      <input type="button" value="Call ObjC func with JSON " onclick="OCModel.callWithDict({'name': 'testname', 'age': 10, 'height': 170})">
        <input type="button" value="Call ObjC func with JSON and ObjC call js func to pass args." onclick="OCModel.jsCallObjcAndObjcCallJsWithDict({'name': 'testname', 'age': 10, 'height': 170})">
    </div>
    <a href="test.html">back to previous page</a>
    
    <div>
      <span id="jsParamFuncSpan" style="color: red; font-size: 50px;"></span>
    </div>
    
<!--   如果调用失败，因此此时还没有注入OCModel对象 -->
<script text="javascript">jsFunc();</script>
  </body>
</html>
